<?php
$this->start('toolbar');
echo $this->Html->link(
	'<i class="icon-ok icon-white"></i>&nbsp;'.__('Save'),
	'javascript:;',
	array('escape'=> false, 'class'=> 'btn btn-small btn-success', 'onclick'=> "OWS.submitbutton('save')")
);
echo $this->Html->link(
	'<i class="icon-plus"></i>&nbsp;'.__('Save & New'),
	'javascript:;',
	array('escape'=> false, 'class'=> 'btn btn-small btn-info', 'onclick'=> "OWS.submitbutton('save2new')")
);
echo $this->Html->link(
	'<i class="icon-circle-arrow-left"></i>&nbsp;'.__('Back'),
	'javascript:;',
	array('escape'=> false, 'class'=> 'btn btn-small', 'onclick'=> "javascript:history.back()")
);
$this->end();
$dateFormat = Configure::read('Setting.date_format');
?>
<?php echo $this->Form->create('Task', array('id'=> 'task_form', 'class'=> 'form-validate form-horizontal', 'inputDefaults'=> array('div'=> false, 'label'=> false))) ?>
	<div class="control-group">
		<div class="control-label"><?php echo __('Name') ?><span class="star">&nbsp;*</span></div>
		<div class="controls"><?php echo $this->Form->input('name') ?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Assigned To') ?><span class="star">&nbsp;*</span></div>
		<div class="controls"><?php echo $this->Form->input('Recipient.username', array('disabled'=> true)) ?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Test') ?><span class="star">&nbsp;*</span></div>
		<div class="controls"><?php echo $this->Form->input('Test.name', array('disabled'=> true)) ?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Question number') ?><span class="star">&nbsp;*</span></div>
		<div class="controls"><?php echo $this->Form->input('question_number', array('type'=> 'number')) ?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Progress') ?></div>
		<div class="controls"><?php echo $this->Form->input('progress', array('value'=> round($this->data['Task']['question_count']*100/$this->data['Task']['question_number'])."%", 'disabled'=> true)) ?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Estimate Time') ?></div>
		<div class="controls"><?php echo $this->Form->input('estimate_time') ?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Start Date') ?></div>
		<div class="controls"><?php echo $this->Form->input('start_date', array('type'=> 'text', 'id'=> 'dpStartDate',
  					'value'=> isset($this->data['Task']['start_date'])?$this->data['Task']['start_date']:date($dateFormat),
  		))?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Due Date') ?></div>
		<div class="controls"><?php echo $this->Form->input('due_date', array('type'=> 'text', 'id'=> 'dpDueDate',
  					'value'=> isset($this->data['Task']['due_date'])?$this->data['Task']['due_date']:date($dateFormat),
  		))?></div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo __('Status') ?><span class="star">&nbsp;*</span></div>
		<div class="controls"><?php echo $this->Form->select('status', Configure::read('Constant.status_task'), array('empty'=> false)) ?></div>
	</div>
<?php echo $this->Form->hidden('task', array('id'=> 'task'))?>
<?php echo $this->Form->end() ?>
<script type="text/javascript">
$('#dpStartDate, #dpDueDate').datepicker({
    dateFormat: "<?php echo Configure::read('Setting.date_format_js') ?>",
    minDate: 0
});
OWS.submitbutton = function(task) {
	OWS.submitform(task, document.getElementById('task_form'));
};
</script>